<?php
/**
 * Created by PhpStorm.
 * User: 554665488
 * Date: 2018-7-2
 * Time: 17:50
 * @description:
 * @Author: yfl
 * @QQ 554665488
 */
$client = new swoole_client(SWOOLE_SOCK_TCP, SWOOLE_SOCK_SYNC);
// 随后建立连接，连接失败直接退出并打印错误码
$client->connect('127.0.0.1', 9501, 6) || exit("connect failed. Error: {$client->errCode}\n");
// 向服务端发送数据
$data = 'select * from test';
$packge = pack('N', strlen($data)) . $data;
for ($i = 0; $i < 60; $i++) {
    $client->send("$packge");
}
//$client->send("5546565488");
// 从服务端接收数据
//$response = $client->recv();
// 输出接受到的数据
//var_dump($response);
//echo $response . PHP_EOL;
// 关闭连接
$client->close();